# 公共接口
from datetime import datetime, timedelta, timezone
from typing import Union
from fastapi import APIRouter, Depends, HTTPException, status, Body, Request
from sqlalchemy.orm import Session
from router.route_log import LogRoute
from model.User import UserModel
from common.setting import settings
from common.db_init import get_db
from common.response import ApiResponse, CustomApiResponse, response_code, responseCode

from common.custom_log import my_logger
from common.state import get_state_manager, StateManager

commonController = APIRouter(prefix='/common',route_class=LogRoute)


@commonController.get('/ws_conn')
async def test(state_manager: StateManager = Depends(get_state_manager)):
    print(state_manager.get_all_state())
    await state_manager.get_state('user_1').send_json({'code': '200', 'msg': '哈哈哈哈'})
    return 123
